#include <cstdio>
#include <iostream>
#include <vector>
#include <algorithm>
#include <cstring>
#include <string>
#include <cmath>
#include <map>
#include <set>
#include <climits>
#include <cassert>
#include <cctype>
using namespace std;

typedef long long ll;
typedef double dbl;
typedef long double ld;

#define mp make_pair
#define pb push_back
#define sz(x) (int)x.size()
#define all(x) x.begin(),x.end()
#define X first
#define Y second

const int maxn = 2000 * 100 + 10;

ll gcd(ll a, ll b) {
	if (b == 0) return a;
	return gcd(b, a % b);
}

pair <ll, ll> add (pair <ll, ll> p1, pair <ll, ll> p2) {
	pair <ll, ll> p;
	p.first = p1.first*p2.second + p2.first*p1.second;
	p.second = p1.second*p2.second;
	return p;
}

int main() {
	freopen("input.txt", "r", stdin);
	freopen("output.txt", "w", stdout);
	
	string s;
	while (true) {
		getline(cin, s);
		if (s == "#") break;
		vector <int> v;
		for (int i = 0; i < sz(s); ) {
			if (s[i] == 'n') {
				i += 5;
				v.push_back(0);
			} else {
				i += 4;
				v.push_back(1);
			}
		}
		reverse(all(v));
		pair <ll, ll> cur = mp((v[0] == 0) ? 0 : 90, 1);
		for (int i = 1; i < sz(v); i++) {
			if (v[i] == 0) {
				cur = add(cur, mp(-90, 1 << i));
				ll d = gcd(cur.first, cur.second);
				cur.X /= d;
				cur.Y /= d;
			}
			else {
				cur = add(cur, mp(90, 1 << i));
				ll d = gcd(cur.first, cur.second);
				cur.X /= d;
				cur.Y /= d;
			}
		}
		if (cur.Y == 1) {
			printf("%lld\n", cur.X);
		} else {
			printf("%lld/%lld\n", cur.X, cur.Y);
		}
	}
	return 0;
}